ALMaSS  1.0
The Animal, Landscape and Man Simulation System
Rabbit_Population_Manager.h
Go to the documentation of this file.
1 /*
2 *******************************************************************************************************
3 Copyright (c) 2015, Christopher John Topping, Faarupvej 54, DK-8410 Rønde
4 ADAMA Makhteshim Ltd., PO Box 60, Beer-Sheva 84100, Israel
5 
6 All rights reserved.
7 
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10 
11 1. Redistributions of source code must retain the above copyright notice, this
12 list of conditions and the following disclaimer.
13 2. Redistributions in binary form must reproduce the above copyright notice,
14 this list of conditions and the following disclaimer in the documentation
15 and/or other materials provided with the distribution.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 The views and conclusions contained in the software and documentation are those
29 of the authors and should not be interpreted as representing official policies,
30 either expressed or implied, of the FreeBSD Project.
31 ********************************************************************************************************
32 
33 */
43 //---------------------------------------------------------------------------
44 #ifndef Rabbit_Population_ManagerH
45 #define Rabbit_Population_ManagerH
46 //---------------------------------------------------------------------------
47 
48 //---------------------------------------------------------------------------
49 
50 class Rabbit_Base;
51 
52 //------------------------------------------------------------------------------
53 
59 {
60 public:
62  int m_x;
64  int m_y;
66  int m_x2;
68  int m_y2;
74  int m_age;
82  int m_soil;
83 };
84 
90 {
91 public:
92 // Methods
96  virtual ~Rabbit_Population_Manager (void);
98  void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit* a_data, int a_number);
102  Rabbit_Warren* FindClosestWarren(int a_x, int a_y, int a_rank);
106  bool IsBreedingSeason( void ) { return m_rabbitBreedingSeason; }
110  unsigned SupplyAllBigRabbits() {
111  unsigned sum = 0;
112  for (unsigned r = rob_Male; r < rob_foobar; r++) sum += (unsigned) TheArray[r].size();
113  return sum;
114  }
116  double GetGrowth( int a_age ) {
117 // if ((a_age < 0) || (a_age >= 3650)) {
118 // int rubbish = 1;
119 // }
120  return m_RabbitGrowth[ a_age ];
121  }
123  bool GetForageDay( ) {
124  return m_forageday;
125  }
126 protected:
127 // Attributes
137  double m_RabbitGrowth[3650];
150  // Methods
152  virtual void DoFirst();
154  virtual void DoBefore(){}
156  virtual void DoAfter(){}
158  virtual void DoLast();
162  bool WarrenLegalPos(int &a_x, int a_y);
164  void SaveWarrenLocations( void );
166  void LoadWarrenLocations( void );
168  double AssessPctForage(int a_x, int a_y);
170  void CreateLocalWarrenNetworkLists( void );
184  void WarrenOutputAnalysis();
186  void LifetimeReproAnalysis();
188  void NatalDispersalAnalysis();
198  void AssignStaticVariables();
200  void TheAOROutputProbe();
201 public:
203  void ReproOutputRecordOutput(Rabbit_Female* a_female);
205  void NatalDispersalRecordOutput(Rabbit_Base* a_rabbit);
206 };
207 
208 #endif
TTypesOfRabbitHabitat
A classification of rabbit habitat types. All landscape elements will be classified into one of the c...
Definition: Rabbit.h:102
RabbitObjectTypes
Definition: Rabbit.h:69
@ rob_foobar
Definition: Rabbit.h:75
@ rob_Male
Definition: Rabbit.h:72
The landscape class containing all environmental and topographical data.
Definition: landscape.h:113
Base class for all population managers.
Definition: PopulationManager.h:424
vector< TListOfAnimals > TheArray
Definition: PopulationManager.h:534
Definition: Rabbit.h:166
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:444
The class to handle all predator population related matters.
Definition: Rabbit_Population_Manager.h:90
ofstream m_PesticideDeathOFile
The pesticide death output file.
Definition: Rabbit_Population_Manager.h:147
bool m_forageday
Flag to record whether today is a possible forage day.
Definition: Rabbit_Population_Manager.h:149
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
Definition: Rabbit_Population_Manager.cpp:768
void CreateLocalWarrenNetworkLists(void)
Forms the local warren network list for this warren.
Definition: Rabbit_Population_Manager.cpp:640
void LifetimeReproAnalysis()
Does analysis on the lifetime reproductive output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:1061
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
Definition: Rabbit_Population_Manager.h:110
void NatalDispersalRecordOutputOpen()
Opens the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:923
virtual void DoLast()
Things to do after the EndStep.
Definition: Rabbit_Population_Manager.cpp:360
Rabbit_Warren * FindClosestWarren(int a_x, int a_y, int a_rank)
Finds the closest warren as the crow flies.
Definition: Rabbit_Population_Manager.cpp:692
ofstream m_ReproOutputFile
For recording the lifetime reproductive success.
Definition: Rabbit_Population_Manager.h:145
double m_RabbitGrowth[3650]
Holds daily growth potential of rabbits for each day
Definition: Rabbit_Population_Manager.h:137
void PreProcessWarrenLocations()
This pre-scans the landscape and determines all potential warren locations on start-up.
Definition: Rabbit_Population_Manager.cpp:378
int m_reproswitchbuffer
Prevents continuous breeding season switching.
Definition: Rabbit_Population_Manager.h:135
void PesticideDeathRecordOutput()
Print pesticide death record to file.
Definition: Rabbit_Population_Manager.cpp:852
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
Definition: Rabbit_Population_Manager.h:116
bool WarrenLegalPos(int &a_x, int a_y)
Tests the warrens list to see if this position is legal.
Definition: Rabbit_Population_Manager.cpp:431
int m_warrenfixedsizediv2
Half max warren size in m - for speed
Definition: Rabbit_Population_Manager.h:131
void ReproOutputRecordOutput(Rabbit_Female *a_female)
Print reproductive record to file.
Definition: Rabbit_Population_Manager.cpp:888
bool m_rabbitBreedingSeason
The breeding season flag.
Definition: Rabbit_Population_Manager.h:133
void WarrenOccupancyRecordOutput()
Print warren occupancy record to file.
Definition: Rabbit_Population_Manager.cpp:774
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
Definition: Rabbit_Population_Manager.cpp:250
TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole)
Classify a landscape element type according to the rabbit habitat classification.
Definition: Rabbit_Population_Manager.cpp:457
int m_warrenfixedsize
Holds an input variable for max warren size in m
Definition: Rabbit_Population_Manager.h:129
void ReproOutputRecordOutputClose()
Closes the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:906
virtual void DoBefore()
Things to do before the Step.
Definition: Rabbit_Population_Manager.h:154
void TheAOROutputProbe()
Definition: Rabbit_Population_Manager.cpp:1163
void LoadWarrenLocations(void)
Load warren locations.
Definition: Rabbit_Population_Manager.cpp:610
void NatalDispersalAnalysis()
Does analysis on the natal dispersal output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:1133
void WarrenOccupancyRecordOutputClose()
Closes the warren occupancy output file.
Definition: Rabbit_Population_Manager.cpp:937
double AssessPctForage(int a_x, int a_y)
Assesses the percentage of forage for a location assuming max warren size.
Definition: Rabbit_Population_Manager.cpp:552
int m_PesticideDeaths[rob_foobar]
Holds the number of rabbits killed each day by pesticides.
Definition: Rabbit_Population_Manager.h:139
virtual ~Rabbit_Population_Manager(void)
Rabbit_Population_Manager Destructor.
Definition: Rabbit_Population_Manager.cpp:225
void PesticideDeathRecordOutputClose()
Closes the pesticide death output file.
Definition: Rabbit_Population_Manager.cpp:882
void WarrenOutputAnalysis()
Does analysis on the warren output file and saves the results to RabbitPOMSummary....
Definition: Rabbit_Population_Manager.cpp:943
bool GetForageDay()
Get method for the forage day flag.
Definition: Rabbit_Population_Manager.h:123
ofstream m_NatalDispersalFile
For recording the natal dispersal of adults from birth to death.
Definition: Rabbit_Population_Manager.h:143
void WarrenOccupancyRecordOutputOpen()
Opens the warren occupancy output file.
Definition: Rabbit_Population_Manager.cpp:872
Rabbit_Population_Manager(Landscape *L)
Rabbit_Population_Manager Constructor.
Definition: Rabbit_Population_Manager.cpp:120
virtual void DoFirst()
Things to do before anything else at the start of a timestep
Definition: Rabbit_Population_Manager.cpp:312
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
Definition: Rabbit_Population_Manager.cpp:912
ofstream m_WarrenOccupancyFile
The warren occupancy output file.
Definition: Rabbit_Population_Manager.h:141
bool IsBreedingSeason(void)
Get whether it is breeding season.
Definition: Rabbit_Population_Manager.h:106
void NatalDispersalRecordOutputClose()
Closes the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:931
void SaveWarrenLocations(void)
Save warren locations.
Definition: Rabbit_Population_Manager.cpp:588
void CheckForRabbitBreedingConditions(void)
Determines whether it is breeding season.
Definition: Rabbit_Population_Manager.cpp:735
virtual void DoAfter()
Things to do before the EndStep.
Definition: Rabbit_Population_Manager.h:156
void ReproOutputRecordOutputOpen()
Opens the reproductive output file.
Definition: Rabbit_Population_Manager.cpp:898
void AssignStaticVariables()
Assigns any static variables needing config variable assignment.
Definition: Rabbit_Population_Manager.cpp:203
void PesticideDeathRecordOutputOpen()
Opens pesticide death output file.
Definition: Rabbit_Population_Manager.cpp:866
A class to describe the rabbits warren system.
Definition: Rabbit.h:519
The rabbit young class. All special young behaviour is described here.
Definition: Rabbit.h:320
The base class for all ALMaSS animal classes.
Definition: PopulationManager.h:205
Used for creation of a new Rabbit object.
Definition: Rabbit_Population_Manager.h:59
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
Definition: Rabbit_Population_Manager.h:72
int m_y
y-coord
Definition: Rabbit_Population_Manager.h:64
int m_x2
x-coord of birth
Definition: Rabbit_Population_Manager.h:66
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
Definition: Rabbit_Population_Manager.h:78
int m_age
The rabbit age.
Definition: Rabbit_Population_Manager.h:74
Rabbit_Warren * m_Warren
A pointer to the current warren.
Definition: Rabbit_Population_Manager.h:80
int m_soil
The current warren soil type.
Definition: Rabbit_Population_Manager.h:82
int m_y2
y-coord of birth
Definition: Rabbit_Population_Manager.h:68
Landscape * m_L
Landscape pointer.
Definition: Rabbit_Population_Manager.h:70
int m_weightage
The rabbit age in terms of weight.
Definition: Rabbit_Population_Manager.h:76
int m_x
x-coord
Definition: Rabbit_Population_Manager.h:62
TTypesOfLandscapeElement
Definition: tole_declaration.h:36